<?php
class SF_Shippingquery_VendorController extends Mage_Core_Controller_Front_Action
{
	public function queryAction()
	{
		$weight = !empty($this->getRequest()->getParam('weight')) ? floatval($this->getRequest()->getParam('weight')) : 0;
		$shippingCode = !empty($this->getRequest()->getParam('shippingcode')) ? $this->getRequest()->getParam('shippingcode') : 0;
		$vendorId = (int)$this->getRequest()->getParam('vendorid');
		if(!$vendorId)
		{
			echo 'vendorid is null.';
			return;
		}

		//returnShippingPrice返回物流类型和重量的价格，shippingCode：16为挂号，14为专递
		$shippingPrice = Mage::helper('shippingquery')->returnShippingPrice($vendorId,$shippingCode,$weight);
		print($shippingPrice);
	}

	public function queryAllAction()
	{

		$weight = !empty($this->getRequest()->getParam('weight')) ? floatval($this->getRequest()->getParam('weight')) : 0;
		$vendorId = (int)$this->getRequest()->getParam('vendorid');
		if(!$vendorId)
		{
			echo 'vendorid is null.';
			return;
		}
		$shippingPrice = Mage::helper('shippingquery')->returnAllShippingPrice($vendorId,$weight);
		var_dump($shippingPrice);
	}
}
